Technical Q&A OPS14
Determining if a 680x0 program is Running on a PPC


Q How do I determine if my 68K program is running on a PPC?

A The best way to do this is to use the Gestalt Selectors as described in the Universal Interface file Gestalt.h:
enum {
    gestaltSysArchitecture = 'sysa',   /* Native System Architecture */
    gestalt68k    = 1,                   /* Motorola MC68k architecture */
    gestaltPowerPC    = 2                /* IBM PowerPC architecture */
};

A snippet of code that uses this could look something like this in your 68K program:

#include <gestalt.h>#include <stdio.h>#include <Types.h>
    long myattr;
    OSErr err;

     err = Gestalt( gestaltSysArchitecture, &myattr;);
     if (err == noErr) {
        if (myattr == gestaltPowerPC) {
            InstallExtraPPCComp();
        }
    } else {
        // handle error condition
    }

Updated: 27-September-96


Developer Documentation | Technical Notes | Development Kits | Sample Code